<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div class="mar-b12 posrelative">
    <form>

    </form>

    <i class="add_pop_i mar-r6">*</i><span class="mar-r6 w75">banner图片：</span>
    <button class="banneredit_upload">选择图片上传</button>
    <div id="banneredit_from" class="banneredit_from">
        <input class="banneredit_input" type="file" name="file" id="editupload_input" v-model="upload_input"/>
    </div>
    <div>
        <a onclick="up_show()">上传</a>
    </div>
    <img :src.sync="upimg" alt="" v-if="up_img" class="up_img"/><a class="up_del" v-if="up_img" @click="up_del">删除</a>
</div>
<script src="/js/jquery-3.5.1.min.js"></script>
<script>
    function up_show(){   //图片上传
        var editupload_input=$("#editupload_input"),
            banneredit_from=$( "#banneredit_from" );
        var formData = new FormData(banneredit_from[0]);
        formData.append('file', editupload_input[0].files[0]);
        var that=this;
        if(editupload_input.val()==''){
            this.$Message.info('图片地址不能为空');
        }else{
            $.ajax({
                url: "/upload",
                type: "POST",
                data: formData,
                contentType: false,
                processData: false,
                success: function(msg){
                    if(msg.success){
                        that.upimg=msg.url;
                        that.up_img=true;
                    }else{
                        that.$Message.info(msg.errorMessage);
                    };
                }
            });
        };
    }
</script>


</body>
</html>